﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Windows.Threading;
using System.Collections.ObjectModel;

namespace HSE.Common
{
     [System.ComponentModel.DesignTimeVisible(false)]
    public partial class PhotoMove : UserControl
    {
        public DispatcherTimer _timer1;
        int refeshCycle = 5;
        ObservableCollection<PhotoInfo> _infos;

        public PhotoMove()
        {
            InitializeComponent();

            _timer1 = new DispatcherTimer();
            _timer1.Tick += new EventHandler(_timer1_Tick);
            _timer1.Interval = new TimeSpan(0, 0, refeshCycle);
            
        }

        public void Binding(ObservableCollection<PhotoInfo> infos)
        {
            _infos = infos;
            lst.ItemsSource = _infos;
            _timer1.Start();
        }

        void _timer1_Tick(object sender, EventArgs e)
        {
            _timer1.Stop();
            PhotoInfo info = _infos[0];
            _infos.Remove(info);
            _infos.Add(info);
            _timer1.Start();
        }
    }
}
